import Vue from "vue"
import VueRouter from "vue-router"

Vue.use(VueRouter)

// 配置项目路由
const router = new VueRouter({
  routes: [
    {
      path: '/',
      redirect: '/home' // 重定向
    },
    {
      path: '/home',//首页
      name: 'Home',
      component: () => import('@/views/Home'),
      meta: { // 用来判断该组件对应的页面是否显示底部tabbar
        isShowTabbar: true
      },
      children: [
        {
          path: 'searchpop',
          name: 'Searchpop',
          component: () => import('@/views/Searchpop')
        }
      ]
    },
    {
      path: '/category',//分类
      name: 'Category',
      component: () => import('@/views/Category'),
      meta: { // 用来判断该组件对应的页面是否显示底部tabbar
        isShowTabbar: true
      }
    },
    {
      path: '/topic',//专题
      name: 'Topic',
      component: () => import('@/views/Topic'),
      meta: {
        isShowTabbar: true
      }
    },
    {
      path: '/cart',//购物车
      name: 'Cart',
      component: () => import('@/views/Cart'),
      meta: {
        isShowTabbar: true
      }
    },
    {
      path: '/user',//我的
      name: 'User',
      component: () => import('@/views/User'),
      meta: {
        isShowTabbar: true
      },
    },
    {
      path: '/channel', // 产品分类页面（从首页类别点进去如 居家-餐厨-配件。。。 ）
      name: 'Channel',
      component: () => import('@/views/Channel')
    },
    {
      path: '/productDetail', //产品详情
      name: 'ProductDetail',
      component: () => import('@/views/ProductDetail')
    },
  ],
  mode: 'history',
  base: process.env.BASE_URL,
})

export default router

